<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<!--suppress HtmlRequiredTitleElement -->
<head>
    <th:block th:include="include :: header('定时任务调度')"/>
    <style>
        form:not(.toolbar) .layui-form-label {
            width: 140px;
        }

        form:not(.toolbar) .layui-input-block {
            margin-left: 170px;
        }
    </style>
</head>
<body class="layui-layout-body theme-himio layui-anim layui-anim-upbit">
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!-- 表格工具栏 -->
            <form class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">任务名称:</label>
                        <div class="layui-input-inline">
                            <input name="jobName" class="layui-input" placeholder="请输入任务名称"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">任务组名:</label>
                        <div class="layui-input-inline">
                            <label>
                                <select name="jobGroup" th:with="type=${@dict.getType('sys_job_group')}">
                                    <option value="">全部</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                            th:value="${dict.dictValue}"></option>
                                </select>
                            </label>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">目标字符串:</label>
                        <div class="layui-input-inline">
                            <input name="invokeTarget" class="layui-input" placeholder="请输入调用目标字符串"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">状态:</label>
                        <div class="layui-input-inline">
                            <label>
                                <select name="status" th:with="type=${@dict.getType('sys_job_status')}">
                                    <option value="">全部</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                            th:value="${dict.dictValue}"></option>
                                </select>
                            </label>
                        </div>
                    </div>
                    <div class="layui-inline">&emsp;
                        <button class="layui-btn icon-btn" lay-filter="jobTbSearch" lay-submit>
                            <i class="layui-icon layui-icon-search"></i>搜索
                        </button>
                    </div>
                </div>
            </form>
            <!-- 数据表格 -->
            <table id="jobTable" lay-filter="jobTable"></table>
        </div>
    </div>
</div>

<!--表格操作工具按钮-->
<script type="text/html" id="jobTbBar">
    <a class="layui-btn layui-bg-blue layui-btn-sm icon-btn" lay-event="edit" shiro:hasPermission="monitor:job:edit"><i
            class="fa fa-edit"></i>修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-sm icon-btn" lay-event="del"
       shiro:hasPermission="monitor:job:remove"><i class="fa fa-trash"></i>删除</a>
    <a class="layui-btn layui-bg-cyan layui-btn-sm icon-btn" lay-event="jobMore" id="jobMore"
       shiro:hasPermission="monitor:job:changeStatus,monitor:job:list"><i
            class="fa fa-angle-right"></i>更多操作</a>
</script>


<!-- 表单弹窗 edit -->
<script type="text/html" id="jobEditDialog">
    <form id="jobEditForm" lay-filter="jobEditForm" class="layui-form model-form">
        <input name="jobId" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">任务名称:</label>
            <div class="layui-input-block">
                <input name="jobName" class="layui-input" lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">任务组名:</label>
            <div class="layui-input-block">
                <label>
                    <select name="jobGroup" th:with="type=${@dict.getType('sys_job_group')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                th:selected="${dict.default}"></option>
                    </select>
                </label>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">调用目标字符串:</label>
            <div class="layui-input-block">
                <input type="text" name="invokeTarget" placeholder="请输入调用目标字符串" class="layui-input" lay-verType="tips"
                       lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">cron执行表达式:</label>
            <div class="layui-input-block">
                <input type="text" name="cronExpression" id="cron" placeholder="请输入cron执行表达式" class="layui-input"
                       lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">计划执行错误策略:</label>
            <div class="layui-input-block">
                <label>
                    <select name="misfirePolicy" th:with="type=${@dict.getType('sys_job_error_policy')}">
                        <option value="">全部</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                th:selected="${dict.default}"></option>
                    </select>
                </label>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">是否并发执行:</label>
            <div class="layui-input-block">
                <input type="radio" th:each="dict : ${@dict.getType('sys_normal_disable')}" th:id="${dict.dictCode}"
                       name="concurrent" th:value="${dict.dictValue}" th:title="${dict.dictLabel}"
                       th:checked="${dict.default}"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">状态:</label>
            <div class="layui-input-block">
                <input type="radio" th:each="dict : ${@dict.getType('sys_job_status')}" th:id="${dict.dictCode}"
                       name="status" th:value="${dict.dictValue}" th:title="${dict.dictLabel}"
                       th:checked="${dict.default}"/>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn" lay-filter="jobEditSubmit" lay-submit>保存</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </form>
</script>


<!-- js部分 -->
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var addFlag = [[${@permission.hasPermit('monitor:job:add')}]];
    var editFlag = [[${@permission.hasPermit('monitor:job:edit')}]];
    var removeFlag = [[${@permission.hasPermit('monitor:job:remove')}]];
    var exportFlag = [[${@permission.hasPermit('monitor:job:export')}]];
    var dictSysJobGroup = [[${@dict.getType('sys_job_group')}]];
    var dictSysJobErrorPolicy = [[${@dict.getType('sys_job_error_policy')}]];
    var dictSysNormalDisable = [[${@dict.getType('sys_normal_disable')}]];
    var dictSysJobStatus = [[${@dict.getType('sys_job_status')}]];
    var prefix = ctx + "monitor/job";
</script>
<script th:src="@{/static/assets/system/js/job.js}"></script>
</body>
</html>

